<?php
	FLEA::loadClass('FLEA_Db_TableDataGateway');

	class	Model_Auction	extends		FLEA_Db_TableDataGateway
	{
		var		$tableName		=	'auction';
		var		$primaryKey		=	'AuctionID';
		
		/**
		 * get action informaton of the invention
		 *
		 * @param unknown_type $actionID
		 */
		function	findAuction($inventionID)
		{
			return $this->findByField('InventionID',$inventionID);
		}
		
		function	saveAuction($auction)
		{
			$au 	=	$this->findAuction($auction['InventionID']);
			if($au['InventionID'] != $auction['InventionID'])
			{
				return $this->create($auction);
			}
			else
			{
				$auction['AuctionID']	=	$au['AuctionID'];
				return $this->save($auction);
			}
		}
	}
?>